<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: motion.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_12cda917fe1d7c8b4e7d2501bb3636e4.html">sdk</a></li><li class="navelem"><a class="el" href="dir_2f23e30b638d6a5f333babd9a5d183e1.html">include</a></li><li class="navelem"><a class="el" href="dir_d5ace589187da7c83c1a7507ec9fbbef.html">sifteo</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">motion.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * This file is part of the public interface to the Sifteo SDK.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright &lt;c&gt; 2012 Sifteo, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifdef NOT_USERSPACE</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#   error This is a userspace-only header, not allowed by the current build.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;sifteo/abi.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;sifteo/cube.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;sifteo/math.h&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">namespace </span>Sifteo {</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="keyword">template</span> &lt; <span class="keywordtype">unsigned</span> tSize = 32 &gt;</div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html">   61</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer</a> {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keyword">struct </span>SysType {</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        _SYSMotionBufferHeader header;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        _SYSByte4 samples[tSize];</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    } sys;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html#a03dcaddd84e862d6eb134ec6940deadd">   68</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_motion_buffer.html#a03dcaddd84e862d6eb134ec6940deadd" title="Duration of the MotionBuffer&#39;s timestamp unit, in nanoseconds.">TICK_NS</a> = _SYS_MOTION_TIMESTAMP_NS;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html#a8b5fb69f39bb685c573c19316b39f9ab">   71</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_motion_buffer.html#a8b5fb69f39bb685c573c19316b39f9ab" title="Duration of the MotionBuffer&#39;s timestamp unit, in microseconds.">TICK_US</a> = _SYS_MOTION_TIMESTAMP_NS / 1000;</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html#a3c6c96116960f2d30e71db772c528ded">   74</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="struct_sifteo_1_1_motion_buffer.html#a3c6c96116960f2d30e71db772c528ded" title="Reciprocal of the MotionBuffer&#39;s timestamp unit, in Hertz.">TICK_HZ</a> = _SYS_MOTION_TIMESTAMP_HZ;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <span class="comment">// Implicit conversions</span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keyword">operator</span> _SYSMotionBuffer* () { <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span>_SYSMotionBuffer*<span class="keyword">&gt;</span>(&amp;sys); }</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keyword">operator</span> <span class="keyword">const</span> _SYSMotionBuffer* () <span class="keyword">const</span> { <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keyword">const </span>_SYSMotionBuffer*<span class="keyword">&gt;</span>(&amp;sys); }</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html#ab750cdfb46707c12e07351ebe1a9ba6a">  100</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_motion_buffer.html#ab750cdfb46707c12e07351ebe1a9ba6a" title="Initialize the MotionBuffer and attach it to a cube.">attach</a>(_SYSCubeID <span class="keywordtype">id</span>, <span class="keywordtype">unsigned</span> hz=100)</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    {</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <a class="code" href="group__macros.html#ga83608df0f7c42773fdb6030debad2f60">STATIC_ASSERT</a>(<span class="keywordtype">id</span> &lt; _SYS_NUM_CUBE_SLOTS);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <a class="code" href="group__macros.html#ga83608df0f7c42773fdb6030debad2f60">STATIC_ASSERT</a>(tSize &lt;= _SYS_MOTION_MAX_ENTRIES);</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <a class="code" href="group__memory.html#ga20938d45e7d2889376bd3151c5a1ce44" title="Write &#39;n&#39; zero bytes to memory.">bzero</a>(sys);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        sys.header.last = tSize - 1;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        sys.header.rate = <a class="code" href="struct_sifteo_1_1_motion_buffer.html#a3c6c96116960f2d30e71db772c528ded" title="Reciprocal of the MotionBuffer&#39;s timestamp unit, in Hertz.">TICK_HZ</a> / hz;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="comment">/*</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="comment">         * If this ASSERT fails, the buffer is too close to the top of RAM. This</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment">         * usually means you&#39;ve allocated the MotionBuffer on the stack, which isn&#39;t</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">         * recommended. See the warning in the MotionBuffer class comments.</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment">         */</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(reinterpret_cast&lt;uintptr_t&gt;(<span class="keyword">this</span>) + <span class="keyword">sizeof</span>(_SYSMotionBuffer) &lt;= 0x18000);</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        _SYS_setMotionBuffer(<span class="keywordtype">id</span>, *<span class="keyword">this</span>);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    }</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_motion_buffer.html#a29a51e19e1e7864ed46bbe26cc1e5a60">  136</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Int3</a> <a class="code" href="struct_sifteo_1_1_motion_buffer.html#a29a51e19e1e7864ed46bbe26cc1e5a60" title="Calculate a numerical integral over recent motion data.">integrate</a>(<span class="keywordtype">unsigned</span> duration)</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    {</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        _SYSInt3 result;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        _SYS_motion_integrate(*<span class="keyword">this</span>, duration, &amp;result);</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(result.x, result.y, result.z);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    }</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;};</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div>
<div class="line"><a name="l00155"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html">  155</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_motion_iterator.html" title="Utility for reading low-level motion events from a MotionBuffer.">MotionIterator</a> {</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    _SYSMotionBuffer *buffer;</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    uint32_t tickCounter;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> lastAccel;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    uint8_t head;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a5aaf945e7904fc4914c1b6bd82aa8f70">  164</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a5aaf945e7904fc4914c1b6bd82aa8f70" title="Duration of the MotionBuffer&#39;s timestamp unit, in nanoseconds.">TICK_NS</a> = <a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer&lt;&gt;::TICK_NS</a>;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#ac777f2c43b6f36d8c888dcc18d213e45">  167</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#ac777f2c43b6f36d8c888dcc18d213e45" title="Duration of the MotionBuffer&#39;s timestamp unit, in microseconds.">TICK_US</a> = <a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer&lt;&gt;::TICK_US</a>;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a93e83ec89228d149dcb407bd25c9f5eb">  170</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a93e83ec89228d149dcb407bd25c9f5eb" title="Reciprocal of the MotionBuffer&#39;s timestamp unit, in Hertz.">TICK_HZ</a> = <a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer&lt;&gt;::TICK_HZ</a>;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a882725558803ac1a867884b3caf5ac04">  180</a></span>&#160;    <a class="code" href="class_sifteo_1_1_motion_iterator.html#a882725558803ac1a867884b3caf5ac04" title="Construct a new MotionIterator, attached to the provided MotionBuffer.">MotionIterator</a>(_SYSMotionBuffer *buffer)</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        : buffer(buffer), tickCounter(0), lastAccel(<a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(0,0,0)),</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;          head(buffer-&gt;header.tail) {}</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div>
<div class="line"><a name="l00191"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a75d3fc9b9195471633bbba23ba6f073f">  191</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a75d3fc9b9195471633bbba23ba6f073f" title="Advance to the next motion sample, if possible.">next</a>()</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    {</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <span class="keywordtype">unsigned</span> tail = buffer-&gt;header.tail;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;        <span class="keywordtype">unsigned</span> last = buffer-&gt;header.last;</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        <span class="keywordtype">unsigned</span> head = this-&gt;head;</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        <span class="keywordflow">if</span> (head &gt; last)</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;            head = 0;</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;        <span class="keywordflow">if</span> (head == tail)</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;        _SYSByte4 sample = buffer-&gt;samples[head];</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        this-&gt;head = head + 1;</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        lastAccel = <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(sample.x, sample.y, sample.z);</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        tickCounter += unsigned(uint8_t(sample.w)) + 1;</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    }</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a8f6ed014841821a14f6a7afd4691e8b1">  218</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a8f6ed014841821a14f6a7afd4691e8b1" title="Return the acceleration sample at the iterator&#39;s current position.">accel</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;        <span class="keywordflow">return</span> lastAccel;</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    }</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;</div>
<div class="line"><a name="l00232"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a1758a6f74aad260ba383a922d767c8ed">  232</a></span>&#160;    uint32_t <a class="code" href="class_sifteo_1_1_motion_iterator.html#a1758a6f74aad260ba383a922d767c8ed" title="Return the timestamp at the iterator&#39;s current position, in ticks.">ticks</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;        <span class="keywordflow">return</span> tickCounter;</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    }</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#aa00a582bf0894567de939963d7ac08e8">  245</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#aa00a582bf0894567de939963d7ac08e8" title="Return the timestamp at the iterator&#39;s current position, in seconds.">seconds</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a1758a6f74aad260ba383a922d767c8ed" title="Return the timestamp at the iterator&#39;s current position, in ticks.">ticks</a>() * (1.0f / <a class="code" href="class_sifteo_1_1_motion_iterator.html#a93e83ec89228d149dcb407bd25c9f5eb" title="Reciprocal of the MotionBuffer&#39;s timestamp unit, in Hertz.">TICK_HZ</a>);</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    }</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;</div>
<div class="line"><a name="l00253"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a866ccb3bd10c912b1c89ea9f8630e4f2">  253</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a866ccb3bd10c912b1c89ea9f8630e4f2" title="Modify the tick counter.">setTicks</a>(uint32_t value) {</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        tickCounter = value;</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    }</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_iterator.html#a66f30108237da8211fe752c3ac75cfd7">  267</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_motion_iterator.html#a66f30108237da8211fe752c3ac75cfd7" title="Add a value to the tick counter.">adjustTicks</a>(int32_t value) {</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        tickCounter += value;</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    }</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;};</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;</div>
<div class="line"><a name="l00280"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html">  280</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_motion_median.html" title="Calculate median, minimum, and maximum statistics from a MotionBuffer.">MotionMedian</a> {</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;    _SYSMotionMedian sys;</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;    <span class="comment">// Implicit conversions</span></div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <span class="keyword">operator</span> _SYSMotionMedian* () { <span class="keywordflow">return</span> &amp;sys; }</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    <span class="keyword">operator</span> <span class="keyword">const</span> _SYSMotionMedian* () <span class="keyword">const</span> { <span class="keywordflow">return</span> &amp;sys; }</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;</div>
<div class="line"><a name="l00307"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#a640326844dac4892ce7e4fca59a16476">  307</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_motion_median.html#a640326844dac4892ce7e4fca59a16476" title="Calculate the component-wise median of recent motion data.">calculate</a>(_SYSMotionBuffer *mbuf, <span class="keywordtype">unsigned</span> duration) {</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;        _SYS_motion_median(mbuf, duration, *<span class="keyword">this</span>);</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#acdb84a9e5df6db28508ee99d4bd2b9b8">  312</a></span>&#160;    <a class="code" href="class_sifteo_1_1_motion_median.html#acdb84a9e5df6db28508ee99d4bd2b9b8" title="Construct an uninitialized MotionMedian.">MotionMedian</a>() {}</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#a26f7653215a65546bf50d185a4899939">  315</a></span>&#160;    <a class="code" href="class_sifteo_1_1_motion_median.html#a26f7653215a65546bf50d185a4899939" title="Construct a MotionMedian with data calculated from the supplied MotionBuffer.">MotionMedian</a>(_SYSMotionBuffer *mbuf, <span class="keywordtype">unsigned</span> duration) {</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;        <a class="code" href="class_sifteo_1_1_motion_median.html#a640326844dac4892ce7e4fca59a16476" title="Calculate the component-wise median of recent motion data.">calculate</a>(mbuf, duration);</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    }</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;</div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#ad3ea8f8cef6a95dbefedae89de20dd4b">  320</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_motion_median.html#ad3ea8f8cef6a95dbefedae89de20dd4b" title="Return the median itself, as a vector.">median</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(sys.axes[0].median, sys.axes[1].median, sys.axes[2].median);</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    }</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;</div>
<div class="line"><a name="l00325"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#a7e3a6787c29077057cc9a69988fcb33c">  325</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_motion_median.html#a7e3a6787c29077057cc9a69988fcb33c" title="Return the minimum values for each axis, as a vector.">minimum</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(sys.axes[0].minimum, sys.axes[1].minimum, sys.axes[2].minimum);</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    }</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;</div>
<div class="line"><a name="l00330"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#aeed3435a8cfe983475e5108073d2f1e8">  330</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_motion_median.html#aeed3435a8cfe983475e5108073d2f1e8" title="Return the maximum values for each axis, as a vector.">maximum</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(sys.axes[0].maximum, sys.axes[1].maximum, sys.axes[2].maximum);</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;    }</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;</div>
<div class="line"><a name="l00335"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_motion_median.html#af63de7f4088908f8683b4263ef749a6d">  335</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Int3</a> <a class="code" href="class_sifteo_1_1_motion_median.html#af63de7f4088908f8683b4263ef749a6d" title="Return the difference between maximum and minimum, as a vector.">range</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a>(<a class="code" href="class_sifteo_1_1_motion_median.html#aeed3435a8cfe983475e5108073d2f1e8" title="Return the maximum values for each axis, as a vector.">maximum</a>()) - <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a>(<a class="code" href="class_sifteo_1_1_motion_median.html#a7e3a6787c29077057cc9a69988fcb33c" title="Return the minimum values for each axis, as a vector.">minimum</a>());</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    }</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;};</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div>
<div class="line"><a name="l00351"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html">  351</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html" title="A standard recognizer for shake and tilt gestures.">TiltShakeRecognizer</a> {</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kFilterLatency = <a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer&lt;&gt;::TICK_HZ</a> / 30;</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kTiltThresholdMin = 15;</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kTiltThresholdMax = 26;</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kShakeThresholdMin = 1000;</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kShakeThresholdMax = 50000;</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;</div>
<div class="line"><a name="l00367"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#afa4e1bba1ec375856002761e96737c84">  367</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer&lt;&gt;</a> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#afa4e1bba1ec375856002761e96737c84" title="The MotionBuffer used by this TiltShakeRecognizer.">buffer</a>;</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;</div>
<div class="line"><a name="l00377"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3">  377</a></span>&#160;    <a class="code" href="class_sifteo_1_1_motion_median.html" title="Calculate median, minimum, and maximum statistics from a MotionBuffer.">MotionMedian</a> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3" title="The most recent median data calculated by the TiltShakeRecognizer.">median</a>;</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58">  385</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>;</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;</div>
<div class="line"><a name="l00388"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2">  388</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a>;</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;</div>
<div class="line"><a name="l00396"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac59854881fcc9c51f35f079c47768aeb">  396</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac59854881fcc9c51f35f079c47768aeb" title="Initialize this TiltShakeRecognizer and attach it to a cube.">attach</a>(_SYSCubeID <span class="keywordtype">id</span>)</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    {</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#afa4e1bba1ec375856002761e96737c84" title="The MotionBuffer used by this TiltShakeRecognizer.">buffer</a>.<a class="code" href="struct_sifteo_1_1_motion_buffer.html#ab750cdfb46707c12e07351ebe1a9ba6a" title="Initialize the MotionBuffer and attach it to a cube.">attach</a>(<span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        <a class="code" href="group__memory.html#ga20938d45e7d2889376bd3151c5a1ce44" title="Write &#39;n&#39; zero bytes to memory.">bzero</a>(<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3" title="The most recent median data calculated by the TiltShakeRecognizer.">median</a>);</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;        <a class="code" href="group__memory.html#ga20938d45e7d2889376bd3151c5a1ce44" title="Write &#39;n&#39; zero bytes to memory.">bzero</a>(<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>);</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    }</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;</div>
<div class="line"><a name="l00411"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a21d92e421d68a74044593c8e8972633c">  411</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a21d92e421d68a74044593c8e8972633c" title="Return the physical tilt reading for the attached cube.">physicalTilt</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>;</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    }</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;</div>
<div class="line"><a name="l00425"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#af5b131a4d445867fef50a0e69ce330a3">  425</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html">Byte3</a> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#af5b131a4d445867fef50a0e69ce330a3" title="Return the virtual tilt reading for the attached cube.">virtualTilt</a>(<a class="code" href="group__cube.html#ga8dc17340f515227e9bb34532bfc2fef3" title="An enumeration which names the four sides of a Sifteo cube.">Side</a> orientation)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a0305e2ccb6c70308d3b5d44dbb27e862" title="Rotate this vector about the Z axis counterclockwise by an integer multiple of 90 degrees...">zRotateI</a>(orientation);</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;    }</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;</div>
<div class="line"><a name="l00432"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4">  432</a></span>&#160;    <span class="keyword">enum</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4" title="Change flags, returned by update() to indicate what just changed.">ChangeFlags</a> {</div>
<div class="line"><a name="l00433"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a84dc84f307ac2347279ed05a6f7b3c19">  433</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a84dc84f307ac2347279ed05a6f7b3c19" title="&#39;shake&#39; has changed to &#39;true&#39;">Shake_Begin</a>      = 1 &lt;&lt; 0,                                          </div>
<div class="line"><a name="l00434"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4af7409a54c99a9bf56bf6b2d9f851f267">  434</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4af7409a54c99a9bf56bf6b2d9f851f267" title="&#39;shake&#39; has changed to &#39;false&#39;">Shake_End</a>        = 1 &lt;&lt; 1,                                          </div>
<div class="line"><a name="l00435"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a9f72907f11222345f22c0f8f307c7026">  435</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a9f72907f11222345f22c0f8f307c7026" title="&#39;shake&#39; has changed">Shake_Change</a>     = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a84dc84f307ac2347279ed05a6f7b3c19" title="&#39;shake&#39; has changed to &#39;true&#39;">Shake_Begin</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4af7409a54c99a9bf56bf6b2d9f851f267" title="&#39;shake&#39; has changed to &#39;false&#39;">Shake_End</a>,                         </div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;</div>
<div class="line"><a name="l00437"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4ad2f5f9c41b2311a15f028703c8bcf96d">  437</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4ad2f5f9c41b2311a15f028703c8bcf96d" title="&#39;tilt.x&#39; has changed to -1">Tilt_XNeg</a>        = 1 &lt;&lt; 2,                                          </div>
<div class="line"><a name="l00438"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a52460006adaf9ebc056b38d7ac6cf6c9">  438</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a52460006adaf9ebc056b38d7ac6cf6c9" title="&#39;tilt.x&#39; has changed to 0">Tilt_XZero</a>       = 1 &lt;&lt; 3,                                          </div>
<div class="line"><a name="l00439"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a318fdba520473de4b40819b31fbe3d59">  439</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a318fdba520473de4b40819b31fbe3d59" title="&#39;tilt.x&#39; has changed to +1">Tilt_XPos</a>        = 1 &lt;&lt; 4,                                          </div>
<div class="line"><a name="l00440"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a357fdb093087cefd541a36798eb7f92d">  440</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a357fdb093087cefd541a36798eb7f92d" title="&#39;tilt.x&#39; has changed">Tilt_XChange</a>     = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4ad2f5f9c41b2311a15f028703c8bcf96d" title="&#39;tilt.x&#39; has changed to -1">Tilt_XNeg</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a52460006adaf9ebc056b38d7ac6cf6c9" title="&#39;tilt.x&#39; has changed to 0">Tilt_XZero</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a318fdba520473de4b40819b31fbe3d59" title="&#39;tilt.x&#39; has changed to +1">Tilt_XPos</a>,              </div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;</div>
<div class="line"><a name="l00442"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4afebfe1b3ab31de3ea99a65c41cef70be">  442</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4afebfe1b3ab31de3ea99a65c41cef70be" title="&#39;tilt.y&#39; has changed to -1">Tilt_YNeg</a>        = 1 &lt;&lt; 5,                                          </div>
<div class="line"><a name="l00443"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a509a4fe888c8f527793c23cf61b0adf1">  443</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a509a4fe888c8f527793c23cf61b0adf1" title="&#39;tilt.y&#39; has changed to 0">Tilt_YZero</a>       = 1 &lt;&lt; 6,                                          </div>
<div class="line"><a name="l00444"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8d2794d03ef4a39f4613248b4215d118">  444</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8d2794d03ef4a39f4613248b4215d118" title="&#39;tilt.y&#39; has changed to +1">Tilt_YPos</a>        = 1 &lt;&lt; 7,                                          </div>
<div class="line"><a name="l00445"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8572aefc6188f492076e3cb6cdfa42c7">  445</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8572aefc6188f492076e3cb6cdfa42c7" title="&#39;tilt.y&#39; has changed">Tilt_YChange</a>     = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4afebfe1b3ab31de3ea99a65c41cef70be" title="&#39;tilt.y&#39; has changed to -1">Tilt_YNeg</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a509a4fe888c8f527793c23cf61b0adf1" title="&#39;tilt.y&#39; has changed to 0">Tilt_YZero</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8d2794d03ef4a39f4613248b4215d118" title="&#39;tilt.y&#39; has changed to +1">Tilt_YPos</a>,              </div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;</div>
<div class="line"><a name="l00447"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a899a41cff5edee30b557fbf48761b612">  447</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a899a41cff5edee30b557fbf48761b612" title="&#39;tilt.z&#39; has changed to -1">Tilt_ZNeg</a>        = 1 &lt;&lt; 8,                                          </div>
<div class="line"><a name="l00448"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a3434e37068202a4a1e56a501d2c1cab4">  448</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a3434e37068202a4a1e56a501d2c1cab4" title="&#39;tilt.z&#39; has changed to 0">Tilt_ZZero</a>       = 1 &lt;&lt; 9,                                          </div>
<div class="line"><a name="l00449"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a378dba6d283360200927dc69d7265d60">  449</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a378dba6d283360200927dc69d7265d60" title="&#39;tilt.z&#39; has changed to +1">Tilt_ZPos</a>        = 1 &lt;&lt; 10,                                         </div>
<div class="line"><a name="l00450"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8ce9ce5df240dd8be54e236984a75bf9">  450</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8ce9ce5df240dd8be54e236984a75bf9" title="&#39;tilt.z&#39; has changed">Tilt_ZChange</a>     = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a899a41cff5edee30b557fbf48761b612" title="&#39;tilt.z&#39; has changed to -1">Tilt_ZNeg</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a3434e37068202a4a1e56a501d2c1cab4" title="&#39;tilt.z&#39; has changed to 0">Tilt_ZZero</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a378dba6d283360200927dc69d7265d60" title="&#39;tilt.z&#39; has changed to +1">Tilt_ZPos</a>,              </div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;</div>
<div class="line"><a name="l00452"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a38a244e39aaf1cc75c608609fd7298cc">  452</a></span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a38a244e39aaf1cc75c608609fd7298cc" title="&#39;tilt&#39; has changed">Tilt_Change</a>      = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a357fdb093087cefd541a36798eb7f92d" title="&#39;tilt.x&#39; has changed">Tilt_XChange</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8572aefc6188f492076e3cb6cdfa42c7" title="&#39;tilt.y&#39; has changed">Tilt_YChange</a> | <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8ce9ce5df240dd8be54e236984a75bf9" title="&#39;tilt.z&#39; has changed">Tilt_ZChange</a>,      </div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;    };</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;</div>
<div class="line"><a name="l00469"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#adb652e01d5b155997bb916224f363992">  469</a></span>&#160;    <span class="keywordtype">unsigned</span> <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#adb652e01d5b155997bb916224f363992" title="Update the state of the TiltShakeRecognizer.">update</a>(<span class="keywordtype">int</span> latency = kFilterLatency)</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;    {</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;        <span class="keywordtype">unsigned</span> changed = 0;</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;        <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3" title="The most recent median data calculated by the TiltShakeRecognizer.">median</a>.<a class="code" href="class_sifteo_1_1_motion_median.html#a640326844dac4892ce7e4fca59a16476" title="Calculate the component-wise median of recent motion data.">calculate</a>(<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#afa4e1bba1ec375856002761e96737c84" title="The MotionBuffer used by this TiltShakeRecognizer.">buffer</a>, latency);</div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;        <span class="keyword">auto</span> m = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3" title="The most recent median data calculated by the TiltShakeRecognizer.">median</a>.<a class="code" href="class_sifteo_1_1_motion_median.html#ad3ea8f8cef6a95dbefedae89de20dd4b" title="Return the median itself, as a vector.">median</a>();</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;        <span class="keywordtype">int</span> wobble = <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a1b3953f692a7a68dd4b26600172de7e3" title="The most recent median data calculated by the TiltShakeRecognizer.">median</a>.<a class="code" href="class_sifteo_1_1_motion_median.html#af63de7f4088908f8683b4263ef749a6d" title="Return the difference between maximum and minimum, as a vector.">range</a>().<a class="code" href="struct_sifteo_1_1_vector3.html#a63dd922316fbbb2b05ee7179f9de5ea6" title="Calculate the scalar length (magnitude) of this vector, squared.">len2</a>();</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        <span class="comment">// Shake hysteresis</span></div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;        <span class="keywordflow">if</span> (wobble &gt;= kShakeThresholdMax) {</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;            <span class="keywordflow">if</span> (!<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a>) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a84dc84f307ac2347279ed05a6f7b3c19" title="&#39;shake&#39; has changed to &#39;true&#39;">Shake_Begin</a>;</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;            <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;        } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (wobble &lt; kShakeThresholdMin) {</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a>) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4af7409a54c99a9bf56bf6b2d9f851f267" title="&#39;shake&#39; has changed to &#39;false&#39;">Shake_End</a>;</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;            <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#ac0f44403a7a8552e9f8e81a8b34b07c2" title="The most recent binary shake state.">shake</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;            <span class="comment">// Only update tilt state when wobble is low.</span></div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;            <span class="comment">// Each tilt axis has hysteresis.</span></div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;            <span class="keywordflow">if</span> (m.x &lt;= -kTiltThresholdMax) {</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> != -1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4ad2f5f9c41b2311a15f028703c8bcf96d" title="&#39;tilt.x&#39; has changed to -1">Tilt_XNeg</a>;</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> = -1;</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m.x &gt;= kTiltThresholdMax) {</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> != 1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a318fdba520473de4b40819b31fbe3d59" title="&#39;tilt.x&#39; has changed to +1">Tilt_XPos</a>;</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> = 1;</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(m.x) &lt; kTiltThresholdMin) {</div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> != 0) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a52460006adaf9ebc056b38d7ac6cf6c9" title="&#39;tilt.x&#39; has changed to 0">Tilt_XZero</a>;</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> = 0;</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;            }</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;            <span class="keywordflow">if</span> (m.y &lt;= -kTiltThresholdMax) {</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> != -1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4afebfe1b3ab31de3ea99a65c41cef70be" title="&#39;tilt.y&#39; has changed to -1">Tilt_YNeg</a>;</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> = -1;</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m.y &gt;= kTiltThresholdMax) {</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> != 1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a8d2794d03ef4a39f4613248b4215d118" title="&#39;tilt.y&#39; has changed to +1">Tilt_YPos</a>;</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> = 1;</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(m.y) &lt; kTiltThresholdMin) {</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> != 0) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a509a4fe888c8f527793c23cf61b0adf1" title="&#39;tilt.y&#39; has changed to 0">Tilt_YZero</a>;</div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> = 0;</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;            }</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;            <span class="keywordflow">if</span> (m.z &lt;= -kTiltThresholdMax) {</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> != -1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a899a41cff5edee30b557fbf48761b612" title="&#39;tilt.z&#39; has changed to -1">Tilt_ZNeg</a>;</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> = -1;</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m.z &gt;= kTiltThresholdMax) {</div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> != 1) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a378dba6d283360200927dc69d7265d60" title="&#39;tilt.z&#39; has changed to +1">Tilt_ZPos</a>;</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> = 1;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(m.z) &lt; kTiltThresholdMin) {</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> != 0) changed |= <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a01fb99fdb0c94ff50953a0c9c2a75eb4a3434e37068202a4a1e56a501d2c1cab4" title="&#39;tilt.z&#39; has changed to 0">Tilt_ZZero</a>;</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;                <a class="code" href="class_sifteo_1_1_tilt_shake_recognizer.html#a4c97f21b06aee37eb349fd788461ca58" title="The most recent tilt value.">tilt</a>.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> = 0;</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;            }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;        }</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;        <span class="keywordflow">return</span> changed;</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;    }</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;};</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;};  <span class="comment">// namespace Sifteo</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
